package l.l.w.网易2018实习.安置路灯;

/**
 * Created by llw on 2018/3/28/0028.
 */
import java.util.Scanner;
public class Main{

    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int t = scanner.nextInt();
        for(int i = 0; i < t; ++i){
            int count = 0;
            int n = scanner.nextInt();
            int[] lamps = new int[n];
            String str = scanner.next("[\\.X]*");
            for(int j = 0; j < n; ++j ){
                if(str.charAt(j) == '.')lamps[j] = 0;
                else lamps[j] = 1;
            }
            for(int j = 0; j < n; ){
                if(lamps[j] == 0){
                    lamps[j] = 1;
                    if(j + 1 < n) lamps[j+1] = 1;
                    if(j + 2 < n) lamps[j+2] = 1;
                    count++;
                    j+=2;
                }else{
                    j++;
                }
            }
            System.out.println(count);
        }

    }
}
